package com.xch.bean;

import java.sql.Timestamp;
import java.util.Objects;

public class User {
    private int id;
    private String nickName;
    private String userPhone;
    private String password;
    private Timestamp userRegisterTime;
    private Timestamp userLoginTime;
    private boolean isUser;

    public boolean isUser() {
        return isUser;
    }

    public void setUser(boolean user) {
        isUser = user;
    }

    public User(String nickName, String userPhone, String password) {
        this.nickName = nickName;
        this.userPhone = userPhone;
        this.password = password;
    }

    public User() {
    }

    public User(int id, String nickName, String userPhone, String password, Timestamp userRegisterTime, Timestamp userLoginTime) {
        this.id = id;
        this.nickName = nickName;
        this.userPhone = userPhone;
        this.password = password;
        this.userRegisterTime = userRegisterTime;
        this.userLoginTime = userLoginTime;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Timestamp getUserRegisterTime() {
        return userRegisterTime;
    }

    public void setUserRegisterTime(Timestamp userRegisterTime) {
        this.userRegisterTime = userRegisterTime;
    }

    public Timestamp getUserLoginTime() {
        return userLoginTime;
    }

    public void setUserLoginTime(Timestamp userLoginTime) {
        this.userLoginTime = userLoginTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return id == user.id && Objects.equals(nickName, user.nickName) && Objects.equals(userPhone, user.userPhone) && Objects.equals(password, user.password) && Objects.equals(userRegisterTime, user.userRegisterTime) && Objects.equals(userLoginTime, user.userLoginTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, nickName, userPhone, password, userRegisterTime, userLoginTime);
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", nickName='" + nickName + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", password='" + password + '\'' +
                ", userRegisterTime=" + userRegisterTime +
                ", userLoginTime=" + userLoginTime +
                '}';
    }
}
